﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.IO;

namespace Presentation.AID.WebPart.Presentation.AID.VWPDownload
{
    public partial class VWPDownloadUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string strName = System.Web.HttpContext.Current.Session["FileName"].ToString();
            string sbURL = System.Web.HttpContext.Current.Session["Attachment"].ToString();

            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
            System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;

            response.AppendHeader(@"Content-Disposition", "attachment; filename=" + strName);
            response.AppendHeader(@"Pragma", "cache");
            response.AppendHeader(@"Cache-control", "private");
            response.Redirect(sbURL);
            response.End();
        }
    }
}
